import request from '@/lib'

interface QueryInfo {
  pageNum: number
  pageSize: number
  title: string
  status: number
  sort_id: number
}
interface AddTagForm {
  title: string
  tag_id: number
  sort_id: number
  content: string
}
interface DeleteTagForm {
  id: string
}
interface PublishTagForm {
  id: string,
  status: string
}
interface EditTagForm {
  id: string
  title: string
  tag_id: number
  sort_id: number
  content: string
}
// 获取文章列表
const getArticle = (data: QueryInfo) => {
  return request({
    url: '/article/articleInfo',
    method: 'post',
    data
  })
}
// 新增文章
const addArticle = (data: AddTagForm) => {
  return request({
    url: '/article/add',
    method: 'post',
    data
  })
}
// 删除文章
const deleteArticle = (data: DeleteTagForm) => {
  return request({
    url: '/article/del',
    method: 'post',
    data
  })
}
// 修改文章
const editArticle = (data: EditTagForm) => {
  return request({
    url: '/article/edit',
    method: 'post',
    data
  })
}
// 发布文章
const publishArticle = (data:PublishTagForm) => {
  return request({
    url: '/article/publish',
    method: 'post',
    data
  })
}

export { getArticle, addArticle, deleteArticle, editArticle, publishArticle }